﻿namespace Microsoft.SharePoint.Client
{
    using Microsoft.SharePoint.Client.Workflow;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

    [ScriptType("SP.List", ServerTypeId="{d89f0b18-614e-4b4a-bac0-fd6142b55448}")]
    public class List : SecurableObject
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public List(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        [Remote]
        public ListItem AddItem(ListItemCreationInformation parameters)
        {
            if ((base.Context.ValidateOnClient && (parameters != null)) && ((parameters.LeafName != null) && (parameters.LeafName.Length > 0x80)))
            {
                throw ClientUtility.CreateArgumentException("parameters.LeafName");
            }
            ListItem item = new ListItem(base.Context, new ObjectPathMethod(base.Context, base.Path, "AddItem", new object[] { parameters }));
            item.InitFromCreationInformation(parameters);
            return item;
        }

        [Remote]
        public void DeleteObject()
        {
            ClientAction query = new ClientActionInvokeMethod(this, "DeleteObject", null);
            base.Context.AddQuery(query);
            base.RemoveFromParentCollection();
        }

        [Remote]
        public ChangeCollection GetChanges(ChangeQuery query_)
        {
            if (base.Context.ValidateOnClient && (query_ == null))
            {
                throw ClientUtility.CreateArgumentNullException("query_");
            }
            return new ChangeCollection(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetChanges", new object[] { query_ }));
        }

        [Remote]
        public ListItem GetItemById(int id)
        {
            Dictionary<int, ListItem> dictionary;
            object obj2;
            if (base.ObjectData.MethodReturnObjects.TryGetValue("GetItemById", out obj2))
            {
                dictionary = (Dictionary<int, ListItem>) obj2;
            }
            else
            {
                dictionary = new Dictionary<int, ListItem>();
                base.ObjectData.MethodReturnObjects["GetItemById"] = dictionary;
            }
            ListItem item = null;
            if (!dictionary.TryGetValue(id, out item))
            {
                item = new ListItem(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetItemById", new object[] { id }));
                dictionary[id] = item;
            }
            return item;
        }

        public ListItem GetItemById(string id)
        {
            return this.GetItemByStringId(id);
        }

        [Remote]
        internal ListItem GetItemByStringId(string sId)
        {
            Dictionary<string, ListItem> dictionary;
            object obj2;
            if (base.Context.ValidateOnClient)
            {
                if (sId == null)
                {
                    throw ClientUtility.CreateArgumentNullException("sId");
                }
                if ((sId != null) && (sId.Length == 0))
                {
                    throw ClientUtility.CreateArgumentException("sId");
                }
            }
            if (base.ObjectData.MethodReturnObjects.TryGetValue("GetItemByStringId", out obj2))
            {
                dictionary = (Dictionary<string, ListItem>) obj2;
            }
            else
            {
                dictionary = new Dictionary<string, ListItem>();
                base.ObjectData.MethodReturnObjects["GetItemByStringId"] = dictionary;
            }
            ListItem item = null;
            if (!dictionary.TryGetValue(sId, out item))
            {
                item = new ListItem(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetItemByStringId", new object[] { sId }));
                dictionary[sId] = item;
            }
            return item;
        }

        [Remote]
        public ListItemCollection GetItems(CamlQuery query_)
        {
            if (base.Context.ValidateOnClient)
            {
                Uri uri;
                if (query_ == null)
                {
                    throw ClientUtility.CreateArgumentNullException("query_");
                }
                if (((query_ != null) && (query_.FolderServerRelativeUrl != null)) && (!query_.FolderServerRelativeUrl.StartsWith("/", StringComparison.Ordinal) || !Uri.TryCreate(query_.FolderServerRelativeUrl, UriKind.Relative, out uri)))
                {
                    throw ClientUtility.CreateArgumentException("query_.FolderServerRelativeUrl");
                }
            }
            return new ListItemCollection(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetItems", new object[] { query_ }));
        }

        [Remote]
        public RelatedFieldCollection GetRelatedFields()
        {
            return new RelatedFieldCollection(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetRelatedFields", null));
        }

        [Remote]
        public View GetView(Guid viewGuid)
        {
            Dictionary<Guid, View> dictionary;
            object obj2;
            if (base.ObjectData.MethodReturnObjects.TryGetValue("GetView", out obj2))
            {
                dictionary = (Dictionary<Guid, View>) obj2;
            }
            else
            {
                dictionary = new Dictionary<Guid, View>();
                base.ObjectData.MethodReturnObjects["GetView"] = dictionary;
            }
            View view = null;
            if (!dictionary.TryGetValue(viewGuid, out view))
            {
                view = new View(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetView", new object[] { viewGuid }));
                dictionary[viewGuid] = view;
            }
            return view;
        }

        internal void InitFromCreationInformation(ListCreationInformation creation)
        {
            if (creation != null)
            {
                base.ObjectData.Properties["Description"] = creation.Description;
                base.ObjectData.Properties["TemplateFeatureId"] = creation.TemplateFeatureId;
                base.ObjectData.Properties["Title"] = creation.Title;
            }
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                switch (peekedName)
                {
                    case "ParentWeb":
                        flag = true;
                        reader.ReadName();
                        this.ParentWeb.FromJson(reader);
                        return flag;

                    case "ParentWebUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ParentWebUrl"] = reader.ReadString();
                        return flag;

                    case "Fields":
                        flag = true;
                        reader.ReadName();
                        this.Fields.FromJson(reader);
                        return flag;

                    case "Views":
                        flag = true;
                        reader.ReadName();
                        this.Views.FromJson(reader);
                        return flag;

                    case "UserCustomActions":
                        flag = true;
                        reader.ReadName();
                        this.UserCustomActions.FromJson(reader);
                        return flag;

                    case "Forms":
                        flag = true;
                        reader.ReadName();
                        this.Forms.FromJson(reader);
                        return flag;

                    case "DataSource":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DataSource"] = reader.Read<ListDataSource>();
                        return flag;

                    case "HasExternalDataSource":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["HasExternalDataSource"] = reader.ReadBoolean();
                        return flag;

                    case "WorkflowAssociations":
                        flag = true;
                        reader.ReadName();
                        this.WorkflowAssociations.FromJson(reader);
                        return flag;

                    case "Created":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Created"] = reader.ReadDateTime();
                        return flag;

                    case "LastItemModifiedDate":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["LastItemModifiedDate"] = reader.ReadDateTime();
                        return flag;

                    case "LastItemDeletedDate":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["LastItemDeletedDate"] = reader.ReadDateTime();
                        return flag;

                    case "Id":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Id"] = reader.ReadGuid();
                        return flag;

                    case "Description":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Description"] = reader.ReadString();
                        return flag;

                    case "RootFolder":
                        flag = true;
                        reader.ReadName();
                        this.RootFolder.FromJson(reader);
                        return flag;

                    case "IsSiteAssetsLibrary":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["IsSiteAssetsLibrary"] = reader.ReadBoolean();
                        return flag;

                    case "Title":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Title"] = reader.ReadString();
                        return flag;

                    case "Direction":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Direction"] = reader.ReadString();
                        return flag;

                    case "SchemaXml":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["SchemaXml"] = reader.ReadString();
                        return flag;

                    case "BaseType":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["BaseType"] = reader.ReadEnum<Microsoft.SharePoint.Client.BaseType>();
                        return flag;

                    case "ImageUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ImageUrl"] = reader.ReadString();
                        return flag;

                    case "ItemCount":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ItemCount"] = reader.ReadInt32();
                        return flag;

                    case "BaseTemplate":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["BaseTemplate"] = reader.ReadInt32();
                        return flag;

                    case "DefaultContentApprovalWorkflowId":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DefaultContentApprovalWorkflowId"] = reader.ReadGuid();
                        return flag;

                    case "TemplateFeatureId":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["TemplateFeatureId"] = reader.ReadGuid();
                        return flag;

                    case "DefaultViewUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DefaultViewUrl"] = reader.ReadString();
                        return flag;

                    case "DefaultEditFormUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DefaultEditFormUrl"] = reader.ReadString();
                        return flag;

                    case "DefaultNewFormUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DefaultNewFormUrl"] = reader.ReadString();
                        return flag;

                    case "DefaultDisplayFormUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DefaultDisplayFormUrl"] = reader.ReadString();
                        return flag;

                    case "EnableAttachments":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EnableAttachments"] = reader.ReadBoolean();
                        return flag;

                    case "ServerTemplateCanCreateFolders":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ServerTemplateCanCreateFolders"] = reader.ReadBoolean();
                        return flag;

                    case "EnableFolderCreation":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EnableFolderCreation"] = reader.ReadBoolean();
                        return flag;

                    case "EnableModeration":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EnableModeration"] = reader.ReadBoolean();
                        return flag;

                    case "EnableVersioning":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EnableVersioning"] = reader.ReadBoolean();
                        return flag;

                    case "ForceCheckout":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ForceCheckout"] = reader.ReadBoolean();
                        return flag;

                    case "EnableMinorVersions":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EnableMinorVersions"] = reader.ReadBoolean();
                        return flag;

                    case "DraftVersionVisibility":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DraftVersionVisibility"] = reader.ReadEnum<DraftVisibilityType>();
                        return flag;

                    case "Hidden":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Hidden"] = reader.ReadBoolean();
                        return flag;

                    case "IsApplicationList":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["IsApplicationList"] = reader.ReadBoolean();
                        return flag;

                    case "IsCatalog":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["IsCatalog"] = reader.ReadBoolean();
                        return flag;

                    case "AllowContentTypes":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AllowContentTypes"] = reader.ReadBoolean();
                        return flag;

                    case "DocumentTemplateUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DocumentTemplateUrl"] = reader.ReadString();
                        return flag;

                    case "ContentTypesEnabled":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ContentTypesEnabled"] = reader.ReadBoolean();
                        return flag;

                    case "MultipleDataList":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["MultipleDataList"] = reader.ReadBoolean();
                        return flag;

                    case "OnQuickLaunch":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["OnQuickLaunch"] = reader.ReadBoolean();
                        return flag;

                    case "BrowserFileHandling":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["BrowserFileHandling"] = reader.ReadEnum<Microsoft.SharePoint.Client.BrowserFileHandling>();
                        return flag;

                    case "NoCrawl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["NoCrawl"] = reader.ReadBoolean();
                        return flag;

                    case "ValidationFormula":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ValidationFormula"] = reader.ReadString();
                        return flag;

                    case "ValidationMessage":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ValidationMessage"] = reader.ReadString();
                        return flag;

                    case "ContentTypes":
                        flag = true;
                        reader.ReadName();
                        this.ContentTypes.FromJson(reader);
                        return flag;

                    case "EffectiveBasePermissions":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EffectiveBasePermissions"] = reader.Read<BasePermissions>();
                        return flag;
                }
            }
            return flag;
        }

        [Remote]
        public ClientResult<Guid> Recycle()
        {
            ClientAction query = new ClientActionInvokeMethod(this, "Recycle", null);
            base.Context.AddQuery(query);
            ClientResult<Guid> result = new ClientResult<Guid>();
            base.Context.AddQueryIdAndResultObject(query.Id, result);
            base.RemoveFromParentCollection();
            return result;
        }

        [Remote]
        public void Update()
        {
            ClientAction query = new ClientActionInvokeMethod(this, "Update", null);
            base.Context.AddQuery(query);
        }

        [Remote]
        public bool AllowContentTypes
        {
            get
            {
                base.CheckUninitializedProperty("AllowContentTypes");
                return (bool) base.ObjectData.Properties["AllowContentTypes"];
            }
        }

        [Remote]
        public int BaseTemplate
        {
            get
            {
                base.CheckUninitializedProperty("BaseTemplate");
                return (int) base.ObjectData.Properties["BaseTemplate"];
            }
        }

        [Remote]
        public Microsoft.SharePoint.Client.BaseType BaseType
        {
            get
            {
                base.CheckUninitializedProperty("BaseType");
                return (Microsoft.SharePoint.Client.BaseType) base.ObjectData.Properties["BaseType"];
            }
        }

        [Remote]
        public Microsoft.SharePoint.Client.BrowserFileHandling BrowserFileHandling
        {
            get
            {
                base.CheckUninitializedProperty("BrowserFileHandling");
                return (Microsoft.SharePoint.Client.BrowserFileHandling) base.ObjectData.Properties["BrowserFileHandling"];
            }
        }

        [Remote]
        public ContentTypeCollection ContentTypes
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("ContentTypes", out obj2))
                {
                    return (ContentTypeCollection) obj2;
                }
                ContentTypeCollection types = new ContentTypeCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "ContentTypes"));
                base.ObjectData.ClientObjectProperties["ContentTypes"] = types;
                return types;
            }
        }

        [Remote]
        public bool ContentTypesEnabled
        {
            get
            {
                base.CheckUninitializedProperty("ContentTypesEnabled");
                return (bool) base.ObjectData.Properties["ContentTypesEnabled"];
            }
            set
            {
                base.ObjectData.Properties["ContentTypesEnabled"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "ContentTypesEnabled", value));
                }
            }
        }

        [Remote]
        public DateTime Created
        {
            get
            {
                base.CheckUninitializedProperty("Created");
                return (DateTime) base.ObjectData.Properties["Created"];
            }
        }

        [Remote]
        public ListDataSource DataSource
        {
            get
            {
                base.CheckUninitializedProperty("DataSource");
                return (ListDataSource) base.ObjectData.Properties["DataSource"];
            }
        }

        [Remote]
        public Guid DefaultContentApprovalWorkflowId
        {
            get
            {
                base.CheckUninitializedProperty("DefaultContentApprovalWorkflowId");
                return (Guid) base.ObjectData.Properties["DefaultContentApprovalWorkflowId"];
            }
            set
            {
                base.ObjectData.Properties["DefaultContentApprovalWorkflowId"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DefaultContentApprovalWorkflowId", value));
                }
            }
        }

        [Remote]
        public string DefaultDisplayFormUrl
        {
            get
            {
                base.CheckUninitializedProperty("DefaultDisplayFormUrl");
                return (string) base.ObjectData.Properties["DefaultDisplayFormUrl"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("value");
                    }
                    if ((value != null) && (value.Length == 0))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["DefaultDisplayFormUrl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DefaultDisplayFormUrl", value));
                }
            }
        }

        [Remote]
        public string DefaultEditFormUrl
        {
            get
            {
                base.CheckUninitializedProperty("DefaultEditFormUrl");
                return (string) base.ObjectData.Properties["DefaultEditFormUrl"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("value");
                    }
                    if ((value != null) && (value.Length == 0))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["DefaultEditFormUrl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DefaultEditFormUrl", value));
                }
            }
        }

        [Remote]
        public string DefaultNewFormUrl
        {
            get
            {
                base.CheckUninitializedProperty("DefaultNewFormUrl");
                return (string) base.ObjectData.Properties["DefaultNewFormUrl"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("value");
                    }
                    if ((value != null) && (value.Length == 0))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["DefaultNewFormUrl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DefaultNewFormUrl", value));
                }
            }
        }

        [Remote]
        public string DefaultViewUrl
        {
            get
            {
                base.CheckUninitializedProperty("DefaultViewUrl");
                return (string) base.ObjectData.Properties["DefaultViewUrl"];
            }
        }

        [Remote]
        public string Description
        {
            get
            {
                base.CheckUninitializedProperty("Description");
                return (string) base.ObjectData.Properties["Description"];
            }
            set
            {
                if (base.Context.ValidateOnClient && (value == null))
                {
                    throw ClientUtility.CreateArgumentNullException("value");
                }
                base.ObjectData.Properties["Description"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Description", value));
                }
            }
        }

        [Remote]
        public string Direction
        {
            get
            {
                base.CheckUninitializedProperty("Direction");
                return (string) base.ObjectData.Properties["Direction"];
            }
            set
            {
                base.ObjectData.Properties["Direction"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Direction", value));
                }
            }
        }

        [Remote]
        public string DocumentTemplateUrl
        {
            get
            {
                base.CheckUninitializedProperty("DocumentTemplateUrl");
                return (string) base.ObjectData.Properties["DocumentTemplateUrl"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    Uri uri;
                    if ((value != null) && (value.Length == 0))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                    if ((value != null) && (!value.StartsWith("/", StringComparison.Ordinal) || !Uri.TryCreate(value, UriKind.Relative, out uri)))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["DocumentTemplateUrl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DocumentTemplateUrl", value));
                }
            }
        }

        [Remote]
        public DraftVisibilityType DraftVersionVisibility
        {
            get
            {
                base.CheckUninitializedProperty("DraftVersionVisibility");
                return (DraftVisibilityType) base.ObjectData.Properties["DraftVersionVisibility"];
            }
            set
            {
                base.ObjectData.Properties["DraftVersionVisibility"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DraftVersionVisibility", value));
                }
            }
        }

        [Remote]
        public BasePermissions EffectiveBasePermissions
        {
            get
            {
                base.CheckUninitializedProperty("EffectiveBasePermissions");
                return (BasePermissions) base.ObjectData.Properties["EffectiveBasePermissions"];
            }
        }

        [Remote]
        public bool EnableAttachments
        {
            get
            {
                base.CheckUninitializedProperty("EnableAttachments");
                return (bool) base.ObjectData.Properties["EnableAttachments"];
            }
            set
            {
                base.ObjectData.Properties["EnableAttachments"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "EnableAttachments", value));
                }
            }
        }

        [Remote]
        public bool EnableFolderCreation
        {
            get
            {
                base.CheckUninitializedProperty("EnableFolderCreation");
                return (bool) base.ObjectData.Properties["EnableFolderCreation"];
            }
            set
            {
                base.ObjectData.Properties["EnableFolderCreation"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "EnableFolderCreation", value));
                }
            }
        }

        [Remote]
        public bool EnableMinorVersions
        {
            get
            {
                base.CheckUninitializedProperty("EnableMinorVersions");
                return (bool) base.ObjectData.Properties["EnableMinorVersions"];
            }
            set
            {
                base.ObjectData.Properties["EnableMinorVersions"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "EnableMinorVersions", value));
                }
            }
        }

        [Remote]
        public bool EnableModeration
        {
            get
            {
                base.CheckUninitializedProperty("EnableModeration");
                return (bool) base.ObjectData.Properties["EnableModeration"];
            }
            set
            {
                base.ObjectData.Properties["EnableModeration"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "EnableModeration", value));
                }
            }
        }

        [Remote]
        public bool EnableVersioning
        {
            get
            {
                base.CheckUninitializedProperty("EnableVersioning");
                return (bool) base.ObjectData.Properties["EnableVersioning"];
            }
            set
            {
                base.ObjectData.Properties["EnableVersioning"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "EnableVersioning", value));
                }
            }
        }

        [Remote]
        public FieldCollection Fields
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Fields", out obj2))
                {
                    return (FieldCollection) obj2;
                }
                FieldCollection fields = new FieldCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Fields"));
                base.ObjectData.ClientObjectProperties["Fields"] = fields;
                return fields;
            }
        }

        [Remote]
        public bool ForceCheckout
        {
            get
            {
                base.CheckUninitializedProperty("ForceCheckout");
                return (bool) base.ObjectData.Properties["ForceCheckout"];
            }
            set
            {
                base.ObjectData.Properties["ForceCheckout"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "ForceCheckout", value));
                }
            }
        }

        [Remote]
        public FormCollection Forms
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Forms", out obj2))
                {
                    return (FormCollection) obj2;
                }
                FormCollection forms = new FormCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Forms"));
                base.ObjectData.ClientObjectProperties["Forms"] = forms;
                return forms;
            }
        }

        [Remote]
        public bool HasExternalDataSource
        {
            get
            {
                base.CheckUninitializedProperty("HasExternalDataSource");
                return (bool) base.ObjectData.Properties["HasExternalDataSource"];
            }
        }

        [Remote]
        public bool Hidden
        {
            get
            {
                base.CheckUninitializedProperty("Hidden");
                return (bool) base.ObjectData.Properties["Hidden"];
            }
            set
            {
                base.ObjectData.Properties["Hidden"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Hidden", value));
                }
            }
        }

        [Remote]
        public Guid Id
        {
            get
            {
                base.CheckUninitializedProperty("Id");
                return (Guid) base.ObjectData.Properties["Id"];
            }
        }

        [Remote]
        public string ImageUrl
        {
            get
            {
                base.CheckUninitializedProperty("ImageUrl");
                return (string) base.ObjectData.Properties["ImageUrl"];
            }
        }

        [Remote]
        public bool IsApplicationList
        {
            get
            {
                base.CheckUninitializedProperty("IsApplicationList");
                return (bool) base.ObjectData.Properties["IsApplicationList"];
            }
            set
            {
                base.ObjectData.Properties["IsApplicationList"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "IsApplicationList", value));
                }
            }
        }

        [Remote]
        public bool IsCatalog
        {
            get
            {
                base.CheckUninitializedProperty("IsCatalog");
                return (bool) base.ObjectData.Properties["IsCatalog"];
            }
        }

        [Remote]
        public bool IsSiteAssetsLibrary
        {
            get
            {
                base.CheckUninitializedProperty("IsSiteAssetsLibrary");
                return (bool) base.ObjectData.Properties["IsSiteAssetsLibrary"];
            }
        }

        [Remote]
        public int ItemCount
        {
            get
            {
                base.CheckUninitializedProperty("ItemCount");
                return (int) base.ObjectData.Properties["ItemCount"];
            }
        }

        [Remote]
        public DateTime LastItemDeletedDate
        {
            get
            {
                base.CheckUninitializedProperty("LastItemDeletedDate");
                return (DateTime) base.ObjectData.Properties["LastItemDeletedDate"];
            }
        }

        [Remote]
        public DateTime LastItemModifiedDate
        {
            get
            {
                base.CheckUninitializedProperty("LastItemModifiedDate");
                return (DateTime) base.ObjectData.Properties["LastItemModifiedDate"];
            }
        }

        [Remote]
        public bool MultipleDataList
        {
            get
            {
                base.CheckUninitializedProperty("MultipleDataList");
                return (bool) base.ObjectData.Properties["MultipleDataList"];
            }
            set
            {
                base.ObjectData.Properties["MultipleDataList"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "MultipleDataList", value));
                }
            }
        }

        [Remote]
        public bool NoCrawl
        {
            get
            {
                base.CheckUninitializedProperty("NoCrawl");
                return (bool) base.ObjectData.Properties["NoCrawl"];
            }
            set
            {
                base.ObjectData.Properties["NoCrawl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "NoCrawl", value));
                }
            }
        }

        [Remote]
        public bool OnQuickLaunch
        {
            get
            {
                base.CheckUninitializedProperty("OnQuickLaunch");
                return (bool) base.ObjectData.Properties["OnQuickLaunch"];
            }
            set
            {
                base.ObjectData.Properties["OnQuickLaunch"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "OnQuickLaunch", value));
                }
            }
        }

        [Remote]
        public Web ParentWeb
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("ParentWeb", out obj2))
                {
                    return (Web) obj2;
                }
                Web web = new Web(base.Context, new ObjectPathProperty(base.Context, base.Path, "ParentWeb"));
                base.ObjectData.ClientObjectProperties["ParentWeb"] = web;
                return web;
            }
        }

        [Remote]
        public string ParentWebUrl
        {
            get
            {
                base.CheckUninitializedProperty("ParentWebUrl");
                return (string) base.ObjectData.Properties["ParentWebUrl"];
            }
        }

        [Remote]
        public Folder RootFolder
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("RootFolder", out obj2))
                {
                    return (Folder) obj2;
                }
                Folder folder = new Folder(base.Context, new ObjectPathProperty(base.Context, base.Path, "RootFolder"));
                base.ObjectData.ClientObjectProperties["RootFolder"] = folder;
                return folder;
            }
        }

        [Remote]
        public string SchemaXml
        {
            get
            {
                base.CheckUninitializedProperty("SchemaXml");
                return (string) base.ObjectData.Properties["SchemaXml"];
            }
        }

        [Remote]
        public bool ServerTemplateCanCreateFolders
        {
            get
            {
                base.CheckUninitializedProperty("ServerTemplateCanCreateFolders");
                return (bool) base.ObjectData.Properties["ServerTemplateCanCreateFolders"];
            }
        }

        [Remote]
        public Guid TemplateFeatureId
        {
            get
            {
                base.CheckUninitializedProperty("TemplateFeatureId");
                return (Guid) base.ObjectData.Properties["TemplateFeatureId"];
            }
        }

        [Remote]
        public string Title
        {
            get
            {
                base.CheckUninitializedProperty("Title");
                return (string) base.ObjectData.Properties["Title"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("value");
                    }
                    if ((value != null) && (value.Length > 0xff))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["Title"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Title", value));
                }
            }
        }

        [Remote]
        public UserCustomActionCollection UserCustomActions
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("UserCustomActions", out obj2))
                {
                    return (UserCustomActionCollection) obj2;
                }
                UserCustomActionCollection actions = new UserCustomActionCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "UserCustomActions"));
                base.ObjectData.ClientObjectProperties["UserCustomActions"] = actions;
                return actions;
            }
        }

        [Remote]
        public string ValidationFormula
        {
            get
            {
                base.CheckUninitializedProperty("ValidationFormula");
                return (string) base.ObjectData.Properties["ValidationFormula"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("value");
                    }
                    if ((value != null) && (value.Length > 0x3ff))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["ValidationFormula"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "ValidationFormula", value));
                }
            }
        }

        [Remote]
        public string ValidationMessage
        {
            get
            {
                base.CheckUninitializedProperty("ValidationMessage");
                return (string) base.ObjectData.Properties["ValidationMessage"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("value");
                    }
                    if ((value != null) && (value.Length > 0x400))
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["ValidationMessage"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "ValidationMessage", value));
                }
            }
        }

        [Remote]
        public ViewCollection Views
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Views", out obj2))
                {
                    return (ViewCollection) obj2;
                }
                ViewCollection views = new ViewCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Views"));
                base.ObjectData.ClientObjectProperties["Views"] = views;
                return views;
            }
        }

        [Remote]
        public WorkflowAssociationCollection WorkflowAssociations
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("WorkflowAssociations", out obj2))
                {
                    return (WorkflowAssociationCollection) obj2;
                }
                WorkflowAssociationCollection associations = new WorkflowAssociationCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "WorkflowAssociations"));
                base.ObjectData.ClientObjectProperties["WorkflowAssociations"] = associations;
                return associations;
            }
        }
    }
}

